package com.weixing.mall.provider.api.service;

import com.weixing.mall.base.orm.MPage;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.provider.api.fallback.AgentServieFallback;
import com.weixing.mall.provider.api.model.dto.SaleAgentDto;
import com.weixing.mall.provider.api.model.query.AgentInfoQuery;
import com.weixing.mall.provider.api.model.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: kfc
 * @Description: <br/>
 * Date:Create in 2019/8/2 17:36
 * @Modified By:
 */
@FeignClient(value = "mall-provider-agent", configuration = FeignRibbonClientAutoConfiguration.class, fallback = AgentServieFallback.class)
@Component
public interface AgentServiceRpc {

    @GetMapping(value = "/api/agent/findByMobile")
    Result<AgentVo> findByMobile(@RequestParam(value = "mobile", required = false) String mobile);

    @GetMapping(value = "/api/agent/selectByMobileOrSn")
    Result<AgentVo> selectByMobileOrSn(@RequestParam(value = "searchParam", required = false) String searchParam);


    @GetMapping("/api/agent/findByAgentSn")
    Result<AgentVo> findByAgentSn(@RequestParam(value = "agentSn", required = false) String agentSn);


    @GetMapping("/api/agent/selectByAgentSn")
    Result<AgentRpcVo> selectByAgentSn(@RequestParam(value = "agentSn", required = false) String agentSn);

    @GetMapping("/api/agent/selectByAgentMobile")
    Result<AgentRpcVo> selectByAgentMobile(@RequestParam(value = "mobile", required = false) String mobile);

    @GetMapping("/api/agent/findByAgentInfo")
    Result<AgentVo> findByAgentInfo(AgentInfoQuery agentInfoQuery);

    @GetMapping("api/agent/selectByIdAgentCustomer")
    Result<AgentCustomerVo> selectByIdAgentCustomer(@RequestParam(value = "agentId", required = false) Long agentId);

    @GetMapping("api/agent/selectByParentId")
    List<AgentVo> selectByParentId(@RequestParam(value = "agentId", required = false) Long agentId);

    @GetMapping("api/agent/selectById")
    Result<AgentVo> selectById(@RequestParam(value = "agentId", required = false) Long agentId);

    @GetMapping("api/agent/selectByCustomerIdAgentLevel")
    List<Long> selectByCustomerIdAgentLevel(@RequestParam(value = "parseInt", required = false) int parseInt, @RequestParam(value = "currentUserId", required = false) long currentUserId);

    @GetMapping("api/agent/selectAgentIdByAgentLevel")
    List<Long> selectAgentIdByAgentLevel(@RequestParam(value = "agentLevel", required = false) int agentLevel);

    @GetMapping("api/agent/selectByAgentId")
    Result<AgentRpcVo> selectByAgentId(@RequestParam(value = "agentId", required = false) Long agentId);

    @GetMapping("api/agent/selectAgentTreeByParentId")
    Long[] selectAgentTreeByParentId(@RequestParam(value = "agentId", required = false) Long agentId);

    @GetMapping("api/agent/selectByCustomerId")
    List<AgentCustomerVo> selectByCustomerId(@RequestParam(value = "customerId", required = false) Long customerId);

    @GetMapping("api/agent/selectAuthVoByLoginName")
    Result<AgentAuthVo> selectAuthVoByLoginName(@RequestParam(value = "loginName") String loginName);


    @GetMapping("api/agent/act/discount")
    Result<AgentDiscountVo> selectActDiscount(@RequestParam(value = "id") Long id);

    @GetMapping("api/agent/act/rebaterule")
    Result<AgentRebateRuleInfoVo> selectActRebateRule(@RequestParam(value = "ruleId") Long ruleId, @RequestParam(value = "ruleCode") Integer ruleCode);

    @GetMapping("api/agent/act/bonusrule")
    Result<AgentBonusRuleVo> selectBonusRule(@RequestParam(value = "orderType") Integer orderType);

    @GetMapping("api/agent/selectChildByAgentId")
    Result<MPage<AgentRpcVo>> selectChildByAgentId(@RequestParam(value = "currentPage") long curcurrentPagerent,
                                                   @RequestParam(value = "pageSize") long pageSize,
                                                   @RequestParam(value = "agentId") long agentId);

    @GetMapping("api/agent/selectChildByKefuId")
    Result<MPage<AgentRpcVo>> selectChildByKefuId(@RequestParam(value = "currentPage") long currentPage,
                                                  @RequestParam(value = "pageSize") long pageSize,
                                                  @RequestParam(value = "kefuId") long kefuId);

    @PostMapping("api/agent/updateMobile")
    Result updateMobile(@RequestParam(value = "agentId") Long agentId,@RequestParam(value = "mobile") String mobile);

    @PostMapping("api/agent/updateTradeDate")
    void updateTradeDate(@RequestParam(value = "agentId") Long agentId,@RequestParam(value = "today") String today);

    @GetMapping("api/agent/upgradeMsgTask")
    Result upgradeMsgTask();

    @GetMapping("api/agent/expireTask")
    Result expireTask();

    @PostMapping("api/agent/selectChildByAgent")
    Result<MPage<AgentRpcVo>> selectChildByAgent(@RequestBody SaleAgentDto saleAgentDto);
}
